﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GalaxyTranslator.EntityDataModel;
using GalaxyTranslator.Model;
using GalaxyTranslator.ViewInterfaces;

namespace GalaxyTranslator.Presenters
{
    public class OrderPresenter : BasePresenter<IOrderView>
    {
        public OrderPresenter(IOrderView view) : base(view)
        {
        }

        public void InitView(bool isPostBack)
        {
            if (!isPostBack)
            {
                UpdateOrders();
            }
        }

        private void UpdateOrders()
        {
            View.Orders = DataLayer.GetAllOrders();
        }

        public void AddNewOrder()
        {
            var o = new Order
	            {
		            Id_Status = 1,
					Id_OriginalLang = 1,
					Id_TranslateLang = 2,
					Id_User = 1,
					IsChecked = false,
					Created = DateTime.Now
	            };
	        DataLayer.AddNewOrder(o);
            UpdateOrders();
        }
    }
}